﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ScoreMS.Views
{
    /// <summary>
    /// PersonalCourseView.xaml 的交互逻辑
    /// 
    /// 可以接受一个 teacher_id 参数
    /// </summary>
    public partial class PersonalCourseView : Page
    {
        public PersonalCourseView()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(PersonalCourseViewxaml_Loaded);
        }

        private string teacher_id;

        /// <summary>
        /// 接受页面传递过来的参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetPageParam()
        {
            teacher_id = App.teacher_id;
            var param = App.Current.Properties["frame"];
            if (param != null)    //如果不是查询的当前教师，则显示是哪个教师
            {
                teacher_id = param.ToString();
                lblteacher_id.Text = param.ToString();
                lblteacher.Visibility = System.Windows.Visibility.Visible;
            }
        }

        /// <summary>
        /// 载入数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PersonalCourseViewxaml_Loaded(object sender, RoutedEventArgs e)
        {
            GetPageParam();
            this.dataGrid1.ItemsSource = BLL.TeatherBS.GetCourseList(teacher_id);
        }
    }
}
